﻿/*  
	------------------------------------------------------------------------
	 NQ Core Library
	
	 Homepage: http://www.awzhome.de/
	------------------------------------------------------------------------
	
	This Source Code Form is subject to the terms of the Mozilla Public
	License, v. 2.0. If a copy of the MPL was not distributed with this
	file, You can obtain one at http://mozilla.org/MPL/2.0/.
   
	The Original Code is code of NQ Core Library.

	The Initial Developer of the Original Code is Andreas Weizel.
	Portions created by the Initial Developer are
	Copyright (C) 2012 Andreas Weizel. All Rights Reserved.
	
	Contributor(s): (none)
	
	------------------------------------------------------------------------
*/

using System;
namespace AWZhome.NQ.Core
{
	/// <summary>
	/// Interface for custom, service-specific instance creators,
	/// which are responsible for instantiation of services,
	/// also handling dependecies and auto-injection.
	/// </summary>
	public interface INQServiceInstanceCreator
	{
		/// <summary>
		/// Initializes the service instance creator.
		/// </summary>
		/// <param name="serviceInfo">Service info object describing the services handled by this creator.</param>
		void Initialize(INQServiceInfo serviceInfo);

		/// <summary>
		/// Creates an instance of the service.
		/// </summary>
		/// <typeparam name="T">Service type.</typeparam>
		/// <param name="cctorParamTypes">Types of the dynamic constructor parameters to pass.</param>
		/// <param name="cctorParams">Dynamic constructor parameters to pass.</param>
		/// <returns>Service object or <c>null</c>, if the ServiceInstanceCreator is not
		/// valid or does not support the given service type <typeparamref name="T"/>.</returns>
		T CreateInstance<T>(Type[] cctorParamTypes, object[] cctorParams);
	}
}
